const cloud = require('@cloudbase/node-sdk');
// 使用完整配置初始化云环境
const app = cloud.init({
  env: 'dev-9gb21c9n4fae24cc',  // 使用实际的环境ID
  secretId: "AKIDPjttvqZEkCVdZK0Vpy1udO4YbULzRgjd",
  secretKey: "mMky50rWymPq590hBTbYM1Wr0y64xgFb",
  region: "ap-shanghai"
});
const db = app.database();

describe('ConfigService', () => {
  test('should get SaoBei store config successfully', async () => {
    try {
      const config = await db.collection('order').get();
      // const config = await getSaoBeiStoreConfig(schoolCode, productId);
      console.log('Config from database:', JSON.stringify(config));
      // 如果没有找到配置，提供更详细的错误信息
      if (!config) {
        throw new Error('No configuration found in database. Please check if the config collection has the correct data.');
      }
    } catch (error) {
      console.error('Test failed:', error.message);
      throw error;
    }
  }, 10000);
});
